package 字符串;

/*
需求：
    定义一个方法，把数组{1,2,3}按照指定格式拼接成一个字符串[word1#word2#word3]

* */
public class 指定格式拼接字符串 {
    public static void main(String[] args) {
        int[] a = {1, 2, 3, 4};
        System.out.println(backstring(a));

    }

    public static String backstring(int[] s) {
        String str = "{";
        for (int i = 0; i < s.length - 1; i++) {
            str += "word" + s[i] + "#";
        }
        str += "word" + s[s.length - 1] + "}";
        return str;
    }


}
